import { MeshLambertMaterial, MeshLambertMaterialParameters } from "../../thirdparty/three/imports";
import { Texture3D } from "../textures/Texture3D";
import { Material3D } from "./Material3D";

export interface MeshLambertMaterial3D
{
    get _material(): MeshLambertMaterial;
    set _material(v: MeshLambertMaterial);
}

export class MeshLambertMaterial3D extends Material3D
{
    constructor(parameters?: MeshLambertMaterialParameters)
    {
        super();
        this._material = new MeshLambertMaterial(parameters);
    }

    get color()
    {
        return this._material.color;
    }
    set color(v)
    {
        this._material.color = v;
    }

    get emissive()
    {
        return this._material.emissive;
    }
    set emissive(v)
    {
        this._material.emissive = v;
    }

    get wireframe()
    {
        return this._material.wireframe;
    }
    set wireframe(v)
    {
        this._material.wireframe = v;
    }

    get map()
    {
        if (this._material)
        {
            this._map = Texture3D.get(this._material.map);
        }

        return this._map;
    }
    set map(v)
    {
        this._map = v;
        if (this._material)
        {
            this._material.map = v._texture;
        }
    }
    private _map: Texture3D;
}
